<template>
    <el-form :inline="true" :model="model" class="demo-form-inline">
        <el-form-item label="">
            <el-input v-model="model.libTitle" size="large" placeholder="搜索课程名称" :prefix-icon="Search" clearable />
        </el-form-item>
        <el-form-item label="">
            <el-select v-model="model.libType" size="large" :placeholder="placeholder" clearable style="width: 200px;">
                <el-option v-for="item in libs_types" :key="item.value" :label="item.label" :value="item.dictCode" />
            </el-select>
        </el-form-item>
    </el-form>
</template>

<script setup>
import { Search } from '@element-plus/icons-vue'
import { useVModel } from '@vueuse/core'

const props = defineProps({
    modelValue: {
        type: Object,
        required: true,
    }
})

const emit = defineEmits(['update:modelValue']);
const model = useVModel(props, 'modelValue', emit)


const placeholder = computed(() => {
    const defaultValue = '请选择'
    if (!libs_types.value.length) return defaultValue
    return libs_types.value[0].label || defaultValue
})

const { proxy } = getCurrentInstance()
const { libs_types } = proxy.useDict("libs_types")
</script>
<style scoped></style>